import {getSession} from "../tool";
import {getTimeTable} from './lib/get-time-table'
import {getAnnounceLinks} from './lib/get-announce-link'
import {getNewsList} from './lib/get-news-link'


// 获取课表
export const getTable = async (username: string, password: string) => {
    const config = {
        username: username,
        password: password
    }

    const session = await getSession(config)
    console.log('获取到session：', session);

    if (typeof session === 'string') {
        return await getTimeTable(session, {})
    }

    return new Error('获取session失败')
}

// 获取教务讯息
export const getAnnounceList = async () =>{
    return await getAnnounceLinks()
}

// 获取学校要闻
export const getNews = async () =>{
    return await getNewsList()
}
